﻿<Popup x:Class="Active.Builder.ExpressionEditor.Popup"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Active.Builder.ExpressionEditor"
             mc:Ignorable="d" 
             d:DesignHeight="200" d:DesignWidth="300">

	<Popup.Resources>
		<local:TypeImageConverter x:Key="TypeImageConverter" />
		<DataTemplate x:Key="IconTemplate">
			<Rectangle Width="18" Height="18" Fill="{Binding}"/>
		</DataTemplate>
	</Popup.Resources>
	
	<Grid Name="grdOwner" Width="300" Height="200" >
		<ListBox Name="lblIntellisense"
      IsTextSearchEnabled="True"
      ItemsSource="{Binding Path=.}"
      ScrollViewer.VerticalScrollBarVisibility="Auto"
      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
      VirtualizingStackPanel.IsVirtualizing="True" >
			<ListBox.ItemContainerStyle>
				<Style TargetType="{x:Type ListBoxItem}">
					<EventSetter Event="MouseDoubleClick" Handler="OnListBoxItemDoubleClick" />
				</Style>
			</ListBox.ItemContainerStyle>
			<ListBox.ItemTemplate>
				<DataTemplate>
					<StackPanel Orientation="Horizontal" Margin="2" ToolTip="{Binding Path=Description}">
						<ContentControl Content="{Binding Path=ItemType, Converter={StaticResource TypeImageConverter}}" ContentTemplate="{StaticResource IconTemplate}"/>
						<TextBlock Width="Auto" Text="{Binding Path=Name}" />
					</StackPanel>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>
	</Grid>
</Popup>
